<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="manage.BugManage"%>

<%@page import="java.util.ArrayList"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@include file="JS/session.jsp" %>


<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>查询bug</title>
<link href="css/foreground.css" rel="stylesheet" type="text/css" />
<%@ taglib uri="displaytag" prefix="display"%>
<jsp:useBean id="procedure" scope="page" class="Procedure.UseProcedure"/>  
<jsp:scriptlet>
   pageContext.setAttribute("tableclass", "table_style");
</jsp:scriptlet>

</head>
 
 <BODY id=css-zen-garden>
 <DIV id=container>
<DIV id=intro>
<DIV id=quickSummary>
 <p class=p2>欢迎，<%=session.getAttribute("RealName") %>;<a href="login.jsp">退出</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="EditUser.jsp">修改资料</a>&nbsp;&nbsp;
    <%
     String level= null;
     level=(String)session.getAttribute("UserLevel");
     if(level!=null&&level.equals("0"))
     {
     %> 
      <a href="admin/AddGroup.jsp">进入后台</a>
      <%
       }
       %></p>
</DIV>
<DIV id=preamble>
<H3><SPAN>BUG查询</SPAN></H3>
  <form id="form1" name="form1" method="post" action="QueryBug.jsp?QueryMode=Search">
<table  width="100%" border="0" cellpadding="0" cellspacing="1" class="table_style">
  <tr bgcolor="#52514E">
    <td colspan="3" align="center">请选择你的查询条件</td>
    </tr>
  
  <tr bgcolor="#52514E">
    <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td>第一组</td>
        <td>
          <select name="tname1" class="selectlist" id="tname1">
<option selected="selected" value="c.ProjectID">项目编号</option>
            <option value="ProjectName">项目名称</option>
            <option value="b.ModuleID">模块编号</option>
            <option value="ModuleName">模块名称</option>
            <option value="BugID">BUG编号</option>
            <option value="BugTitle">BUG标题</option>
            <option value="BugStatus">BUG状态</option>
            <option value="BugType">BUG类型</option>
            <option value="OpennedByID">由谁创建</option>
            <option value="AssignedToID">指派给</option>
            <option value="BugSeverity">严重程度</option>
            <option value="BugOS">操作系统</option>
            <option value="OpenedDate">创建日期</option>
            <option value="AssignedDate">指派日期</option>
            <option value="ResolvedByID">由谁解决</option>
            <option value="ResolvedDate">解决日期</option>
            <option value="ClosedDate">关闭日期</option>
          </select>
          </td>

        <td><input name="key1" type="text" class="selectlist"size="1" maxlength="20"/>        </td>
      </tr>
      <tr>
        <td>
            <select name="compare1" class="selectlist" id="compare1">
            <option selected="selected" value="and">并且</option>
            <option value="or">或者</option>
            </select>
            </td>
        <td>
           <select name="tname2" class="selectlist" id="tname2">
<option selected="selected" value="c.ProjectID">项目编号</option>
            <option value="ProjectName">项目名称</option>
            <option value="b.ModuleID">模块编号</option>
            <option value="ModuleName">模块名称</option>
            <option value="BugID">BUG编号</option>
            <option value="BugTitle">BUG标题</option>
            <option value="BugStatus">BUG状态</option>
            <option value="BugType">BUG类型</option>
            <option value="OpennedByID">由谁创建</option>
            <option value="AssignedToID">指派给</option>
            <option value="BugSeverity">严重程度</option>
            <option value="BugOS">操作系统</option>
            <option value="OpenedDate">创建日期</option>
            <option value="AssignedDate">指派日期</option>
            <option value="ResolvedByID">由谁解决</option>
            <option value="ResolvedDate">解决日期</option>
            <option value="ClosedDate">关闭日期</option>
          </select>
        </td>

        <td><input name="key2" type="text" class="selectlist" size="1" maxlength="20" /></td>
      </tr>
      <tr>
        <td><select name="compare2" class="selectlist" id="compare2">
          <option selected="selected" value="and">并且</option>
          <option value="or">或者</option>
        </select></td>
        <td>
          <select name="tname3" class="selectlist" id="tname3">
<option selected="selected" value="c.ProjectID">项目编号</option>
            <option value="ProjectName">项目名称</option>
            <option value="b.ModuleID">模块编号</option>
            <option value="ModuleName">模块名称</option>
            <option value="BugID">BUG编号</option>
            <option value="BugTitle">BUG标题</option>
            <option value="BugStatus">BUG状态</option>
            <option value="BugType">BUG类型</option>
            <option value="OpennedByID">由谁创建</option>
            <option value="AssignedToID">指派给</option>
            <option value="BugSeverity">严重程度</option>
            <option value="BugOS">操作系统</option>
            <option value="OpenedDate">创建日期</option>
            <option value="AssignedDate">指派日期</option>
            <option value="ResolvedByID">由谁解决</option>
            <option value="ResolvedDate">解决日期</option>
            <option value="ClosedDate">关闭日期</option>
          </select>
        </td>

        <td><input name="key3" type="text" class="selectlist" size="1" maxlength="20" /></td>
      </tr>
    </table></td>
    <td>
        <input type="radio" name="radio" value="and" />并且<br />
        <input name="radio" type="radio" value="or" />或者
   </td>
    <td><table width="100%" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td>第二组</td>
        <td>
          <select name="tname4" class="selectlist" id="select8">

<option selected="selected" value="c.ProjectID">项目编号</option>
            <option value="ProjectName">项目名称</option>
            <option value="b.ModuleID">模块编号</option>
            <option value="ModuleName">模块名称</option>
            <option value="BugID">BUG编号</option>
            <option value="BugTitle">BUG标题</option>
            <option value="BugStatus">BUG状态</option>
            <option value="BugType">BUG类型</option>
            <option value="OpennedByID">由谁创建</option>
            <option value="AssignedToID">指派给</option>
            <option value="BugSeverity">严重程度</option>
            <option value="BugOS">操作系统</option>
            <option value="OpenedDate">创建日期</option>
            <option value="AssignedDate">指派日期</option>
            <option value="ResolvedByID">由谁解决</option>
            <option value="ResolvedDate">解决日期</option>
            <option value="ClosedDate">关闭日期</option>
          </select>
        </td>

        <td><input name="key4" type="text" class="selectlist" size="1" maxlength="20" /></td>
      </tr>
      <tr>
        <td>
          <select name="compare3" class="selectlist" id="compare3">
            <option selected="selected" value="and">并且</option>
            <option value="or">或者</option>
          </select>
        </td>
        <td>
         <select name="tname5" class="selectlist" id="select11">
<option selected="selected" value="c.ProjectID">项目编号</option>
            <option value="ProjectName">项目名称</option>
            <option value="b.ModuleID">模块编号</option>
            <option value="ModuleName">模块名称</option>
            <option value="BugID">BUG编号</option>
            <option value="BugTitle">BUG标题</option>
            <option value="BugStatus">BUG状态</option>
            <option value="BugType">BUG类型</option>
            <option value="OpennedByID">由谁创建</option>
            <option value="AssignedToID">指派给</option>
            <option value="BugSeverity">严重程度</option>
            <option value="BugOS">操作系统</option>
            <option value="OpenedDate">创建日期</option>
            <option value="AssignedDate">指派日期</option>
            <option value="ResolvedByID">由谁解决</option>
            <option value="ResolvedDate">解决日期</option>
            <option value="ClosedDate">关闭日期</option>
          </select>
        </td>

        <td><input name="key5" type="text" class="selectlist" size="1" maxlength="20" /></td>
      </tr>
      <tr>
        <td>
          <select name="compare4" class="selectlist" id="compare4">
            <option selected="selected" value="and">并且</option>
            <option value="or">或者</option>
          </select>
        </td>
        <td>
          <select name="tname6" class="selectlist" id="select14">
<option selected="selected" value="c.ProjectID">项目编号</option>
            <option value="ProjectName">项目名称</option>
            <option value="b.ModuleID">模块编号</option>
            <option value="ModuleName">模块名称</option>
            <option value="BugID">BUG编号</option>
            <option value="BugTitle">BUG标题</option>
            <option value="BugStatus">BUG状态</option>
            <option value="BugType">BUG类型</option>
            <option value="OpennedByID">由谁创建</option>
            <option value="AssignedToID">指派给</option>
            <option value="BugSeverity">严重程度</option>
            <option value="BugOS">操作系统</option>
            <option value="OpenedDate">创建日期</option>
            <option value="AssignedDate">指派日期</option>
            <option value="ResolvedByID">由谁解决</option>
            <option value="ResolvedDate">解决日期</option>
            <option value="ClosedDate">关闭日期</option>
          </select>
       </td>

        <td><input name="key6" type="text" class="selectlist" size="1" maxlength="20" /></td>
      </tr>
    </table></td>
  </tr>
  <tr bgcolor="#52514E">
    <td colspan="3" align="center">
      <input name="" type="submit" value="现在查询" />
      <input name="" type="reset" value="重置查询" />
</td>
    </tr>
</table>   </form>
</DIV></DIV>
<DIV id=supportingText>
  <DIV id=requirements>
<H3><SPAN>BUG信息列表</SPAN></H3>
 <% 
    String querymode=null;
   
    String mid=null;
  
    String localuserid=(String)session.getAttribute("UserID");
    if(localuserid!=null)
    {
       int userid=Integer.parseInt(localuserid);
       ArrayList list=new ArrayList();
       querymode=request.getParameter("QueryMode");
       mid=request.getParameter("moduleID");
       if(querymode!=null)
     {   
     if(querymode.equals("Opened"))
    {
       list = BugManage.getOpenedByBugList(userid); 
    }
    else
       if(querymode.equals("AssignedTo"))
        {
          list=BugManage.getAssignedToBugList(userid);
        }
 
       else
           if(querymode.equals("Whole"))
          {
            list=BugManage.getWholeBugList(userid);
          } 
          else
            if(querymode.equals("Search"))
            {
              
	String key = request.getParameter("key1")+","+request.getParameter("key2")+","+request.getParameter("key3")+","+request.getParameter("key4")+","+request.getParameter("key5")+","+request.getParameter("key6");
	String table_field=request.getParameter("tname1")+","+request.getParameter("tname2")+","+request.getParameter("tname3")+","+request.getParameter("tname4")+","+request.getParameter("tname5")+","+request.getParameter("tname6");  //tname.value查询操作的列名
         
    String relation=request.getParameter("compare1")+","+request.getParameter("compare2")+","+request.getParameter("radio")+","+request.getParameter("compare3")+","+request.getParameter("compare4");
      
           list=BugManage.getSearchBugList(table_field,relation,key);
           
           
            }    
         }  
       else
            if(mid!=null)
            {
              list=BugManage.getModuleBugList(Integer.parseInt(mid));
            }
          
            request.setAttribute("results", list);
 %> 
 
   <display:table name="results" pagesize="5" class="table" >
   
    <display:column property="BugID" title="BUG编号" href="BugInfo.jsp" paramId="BugID" paramProperty="BugID" />
   
    <display:column property="BugSeverity" title="严重级别" />
    <display:column property="BugTitle" title="bug标题" />
     <display:column property="BugStatus" title="Bug状态" />
    <display:column property="OpenedByName" title="由谁创建" />
  
     <display:column property="ResolvedByName" title="由谁解决" />
   
  <display:setProperty name="paging.banner.placement" value="bottom" />
    <display:setProperty name="paging.banner.all_items_found">
        <p align=center class="pagebanner">共{0}条{2}</p>
    </display:setProperty>
<display:setProperty name="paging.banner.some_items_found">
        <p align=center class="pagebanner">共{0}条{1}</p>
    </display:setProperty>
    <display:setProperty name="paging.banner.first">
  <div align=center class="pagelinks">
        [<a href="{1}">首页</a>/<a href="{2}">上一页</a>]
        {0}
        [<a href="{3}">下一页</a>/<a href="{4}">尾页</a>]
  </div>
    </display:setProperty>
 <display:setProperty name="paging.banner.full">
  <div align=center class="pagelinks">
        [<a href="{1}">首页</a>/<a href="{2}">上一页</a>]
        {0}
        [<a href="{3}">下一页</a>/<a href="{4}">尾页</a>]
  </div>
    </display:setProperty>
 <display:setProperty name="paging.banner.last">
  <div align=center class="pagelinks">
        [<a href="{1}">首页</a>/<a href="{2}">上一页</a>]
        {0}
        [<a href="{3}">下一页</a>/<a href="{4}">尾页</a>]
  </div>
    </display:setProperty>
 </display:table>
<%} %>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
</DIV>
</DIV>
<DIV id=linkList>
<DIV id=linkList2>
<DIV id=lselect>
<H3 class=select></H3>
<UL>
   <li><a href="QueryBug.jsp?QueryMode=Whole"><span 
  class=accesskey>查看BUG</span></a> </li>
          <li><a href="AddBug.jsp"><span 
  class=accesskey>创建BUG</span></a> </li>
  </UL>
</DIV>
<DIV id=larchives>
<H3 class=archives><SPAN></SPAN></H3>
<UL>
        <LI>
       <form id="Moudule" name="Mudule" method="post" action="">
          <select name="ProductList" class="treelist" id="ProcuctList"  >
           <option value="0">维护项目</option>
          <%  
             String ID=(String)session.getAttribute("UserID");
           if (ID!=null)
             {
             int projectID=0;
            if(request.getParameter("projectID")!=null)
            { 
             projectID=Integer.parseInt(request.getParameter("projectID"));
            }
             int UserID=Integer.parseInt(ID);
             ResultSet rs=procedure.getProjectLists(UserID);
            while(rs.next())
          { String ProjectName=rs.getString("ProjectName");
            int ProjectID=rs.getInt("ProjectID");
            if(ProjectID==projectID)
            {
            %>
             <option  selected="selected"><%=ProjectName %></option>
            <% 
            }
           else
            {
           %> 
            <option  ><%=ProjectName %></option>
          <% 
            }
            }
            rs.close();
            }
          %>
          </select>
     </form>
      </LI>
</UL></DIV>
<DIV id=lresources>
<H3 class=resources></H3>
<UL>
    <li><a href="QueryBug.jsp?QueryMode=AssignedTo"><span class=accesskey>指派给我的BUG</span></a> </li>
    <li><a href="QueryBug.jsp?QueryMode=Opened"><span class=accesskey>由我创建的BUG</span></a> </li>
  </UL>
</DIV></DIV></DIV></DIV></BODY>
</html>